Repository navigation
Conversation
cpu_sensor and aux_sensor are /sys/class/hwmon/hwmonN paths, and hwmonN follows probe order, so after a reboot that probes NVMe drives in another order a saved path can name a different chip. Save each hwmon sensor with its chip name, device path below /sys/devices and tempN input as well, and resolve those again at service start, as controller_identity is for PWM controllers. Existing configurations get the identity recorded at start. A missing or ambiguous identity is never replaced by another sensor: it stands in for the path, has no reading, and so raises the missing-sensor warning; the settings page lists it as not found and keeps it selected.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
Closing this as superseded by #43 and #44. They solve the same problem another way: the page saves the sensor's resolved |
Change
cpu_sensorandaux_sensorare saved as/sys/class/hwmon/hwmonN/tempM_input, andhwmonNfollows probe order. NVMe drives register hwmon devices too, so after a reboot that probes them in another order the saved path can name a different chip. On an Asustor NAS the devices were hwmon0/1nvme, hwmon2acpitz, hwmon3it8625and hwmon4coretemp; a boot that probes the drives last moves the CPU sensor'shwmon4onto an NVMe drive, and the fan follows the drive instead of the CPU without any warning.#12 fixed this for controllers with
controller_identity. This does the same for temperature sensors:/sys/devicesand itstempNinput, e.g.hwmon:coretemp:temp1:platform/coretemp.0, incpu_sensor_identityandaux_sensor_identity(one entry per aux sensor, in order). The key is readable and holds nothing a cfg value, the shell or the comma-separated aux list would need to escape; a chip whose name or device path holds anything else keeps its path binding.migrate_cfg_and_labels, and rewrites only those four fields. Existing configurations get their identities recorded at their first start, from the sensors their saved paths name then.storcli:,nvidia:,mlx:andcustom:sensors are already stable and are saved as they are. Backups validate and restore the new fields.cpu_sensorstill points athwmon4, now an NVMe drive; the fan follows the drivecpu_sensoris resolved to the hwmonN wherecoretempnow is; if it cannot be found, or two inputs match, the fan has no reading from it and warnsTests
tests/sensor_identity_test.php: a fake sysfs with the layout above, renumbered between two boots (NVMe first, then last): identities recorded for an old config without moving anything, both CPU and aux sensors followed to their new hwmonN, unrelated escaped values untouched, no rewrite when nothing changed, an ambiguous identity left unresolved and recovered once the duplicate is gone, a missing chip kept as its identity and found again when it is back, the values the page saves, the "Not found" option, and backup validation (path escape and stray characters refused).tests/aux_sensor_read_test.sh: an unresolved identity in the aux list counts as unread; the other sensors are still read.bash tests/run-all.sh: 36 of 36 pass.No physical-hardware verification yet: the test VM has no hwmon devices, so the renumbering is covered by the fake sysfs only.
Note on #31
#31's diagnostics count aux sensors by kind and file a value that does not start with
/sys/under "other" (Diagnostics.php, the$kindline). A sensor that is saved but not found right now is kept in its identity form, e.g.hwmon:coretemp:temp1:platform/coretemp.0. With both merged that one line would wantstr_starts_with($sensor, 'hwmon:')counted as hwmon too. I can add it to whichever of the two lands second.